﻿@using SmartStore.GoogleMerchantCenter;
@using SmartStore.GoogleMerchantCenter.Providers
@using SmartStore.GoogleMerchantCenter.Models;
@model ProfileConfigurationModel
@{
    Layout = null;
}

<table class="adminContent">
	<tr>
		<td colspan="2">
			<div class="admin-config-group">
				<div class="head">@T("Plugins.Feed.Froogle.GeneralSettings")</div>
			</div>
		</td>
	</tr>
	<tr>
		<td class="adminTitle">
			@Html.SmartLabelFor(m => m.ExportShipping)
		</td>
		<td class="adminData">
			@Html.EditorFor(m => m.ExportShipping)
			@Html.ValidationMessageFor(m => m.ExportShipping)
		</td>
	</tr>
	<tr>
		<td class="adminTitle">
			@Html.SmartLabelFor(m => m.SpecialPrice)
		</td>
		<td class="adminData">
			@Html.EditorFor(m => m.SpecialPrice)
			@Html.ValidationMessageFor(m => m.SpecialPrice)
		</td>
	</tr>
	<tr>
		<td class="adminTitle">
			@Html.SmartLabelFor(m => m.ExportBasePrice)
		</td>
		<td class="adminData">
			@Html.EditorFor(m => m.ExportBasePrice)
			@Html.ValidationMessageFor(m => m.ExportBasePrice)
		</td>
	</tr>
	<tr>
		<td class="adminTitle">
			@Html.SmartLabelFor(m => m.AdditionalImages)
		</td>
		<td class="adminData">
			@Html.EditorFor(m => m.AdditionalImages)
			@Html.ValidationMessageFor(m => m.AdditionalImages)
		</td>
	</tr>
	<tr>
		<td colspan="2">
			<div class="admin-config-group">
				<div class="title">@T("Plugins.Feed.Froogle.DefaultValueSettings")</div>
				<div class="alert alert-info alert-dismissible">
					@T("Plugins.Feed.Froogle.DefaultValueSettingsNote")
					<button type="button" class="close" data-dismiss="alert">&times;</button>
				</div>
			</div>
		</td>
	</tr>
	<tr>
		<td class="adminTitle">
			@Html.SmartLabelFor(m => m.DefaultGoogleCategory)
		</td>
		<td class="adminData wide">
			@Html.DropDownListFor(model => model.DefaultGoogleCategory, Model.AvailableCategories, new { autocomplete = "off" })
			@Html.ValidationMessageFor(m => m.DefaultGoogleCategory)
		</td>
	</tr>
	<tr>
		<td class="adminTitle">
			@Html.SmartLabelFor(m => m.ExpirationDays)
		</td>
		<td class="adminData">
			@Html.EditorFor(m => m.ExpirationDays, new { postfix = T("Time.Days").Text })
			@Html.ValidationMessageFor(m => m.ExpirationDays)
		</td>
	</tr>
	<tr>
		<td class="adminTitle">
			@Html.SmartLabelFor(m => m.Condition)
		</td>
		<td class="adminData">
			@Html.DropDownList("Condition", new List<SelectListItem>
			{
				new SelectListItem { Text = T("Common.Auto"), Value = "" },
				new SelectListItem { Text = T("Common.Unspecified"), Value = GmcXmlExportProvider.Unspecified },
				new SelectListItem { Text = T("Plugins.Feed.Froogle.ConditionNew"), Value = "new" },
				new SelectListItem { Text = T("Plugins.Feed.Froogle.ConditionUsed"), Value = "used" },
				new SelectListItem { Text = T("Plugins.Feed.Froogle.ConditionRefurbished"), Value = "refurbished" }
			})
			@Html.ValidationMessageFor(m => m.Condition)
		</td>
	</tr>
	<tr>
		<td class="adminTitle">
			@Html.SmartLabelFor(m => m.Availability)
		</td>
		<td class="adminData">
			@Html.DropDownList("Availability", new List<SelectListItem>
			{
				new SelectListItem { Text = T("Common.Auto"), Value = "" },
				new SelectListItem { Text = T("Common.Unspecified"), Value = GmcXmlExportProvider.Unspecified },
				new SelectListItem { Text = T("Plugins.Feed.Froogle.AvailabilityInStock"), Value = "in stock" },
				new SelectListItem { Text = T("Plugins.Feed.Froogle.AvailabilityOutOfStock"), Value = "out of stock" },
				new SelectListItem { Text = T("Plugins.Feed.Froogle.AvailabilityPreorder"), Value = "preorder" }
			})
			@Html.ValidationMessageFor(m => m.Availability)
		</td>
	</tr>
	<tr>
		<td class="adminTitle">
			@Html.SmartLabelFor(m => m.Gender)
		</td>
		<td class="adminData">
			@Html.DropDownList("Gender", new List<SelectListItem>
			{
				new SelectListItem { Text = T("Common.Auto"), Value = "" },
				new SelectListItem { Text = T("Common.Unspecified"), Value = GmcXmlExportProvider.Unspecified },
				new SelectListItem { Text = T("Plugins.Feed.Froogle.GenderMale"), Value = "male" },
				new SelectListItem { Text = T("Plugins.Feed.Froogle.GenderFemale"), Value = "female" },
				new SelectListItem { Text = T("Plugins.Feed.Froogle.GenderUnisex"), Value = "unisex" }
			})
			@Html.ValidationMessageFor(m => m.Gender)
		</td>
	</tr>
	<tr>
		<td class="adminTitle">
			@Html.SmartLabelFor(m => m.AgeGroup)
		</td>
		<td class="adminData">
			@Html.DropDownList("AgeGroup", new List<SelectListItem>
			{
				new SelectListItem { Text = T("Common.Auto"), Value = "" },
				new SelectListItem { Text = T("Common.Unspecified"), Value = GmcXmlExportProvider.Unspecified },
				new SelectListItem { Text = T("Plugins.Feed.Froogle.AgeGroupAdult"), Value = "adult" },
				new SelectListItem { Text = T("Plugins.Feed.Froogle.AgeGroupKids"), Value = "kids" }
			})
			@Html.ValidationMessageFor(m => m.AgeGroup)
		</td>
	</tr>
	<tr>
		<td class="adminTitle">
			@Html.SmartLabelFor(m => m.Color)
		</td>
		<td class="adminData">
			@Html.EditorFor(m => m.Color)
			@Html.ValidationMessageFor(m => m.Color)
		</td>
	</tr>
	<tr>
		<td class="adminTitle">
			@Html.SmartLabelFor(m => m.Size)
		</td>
		<td class="adminData">
			@Html.EditorFor(m => m.Size)
			@Html.ValidationMessageFor(m => m.Size)
		</td>
	</tr>
	<tr>
		<td class="adminTitle">
			@Html.SmartLabelFor(m => m.Material)
		</td>
		<td class="adminData">
			@Html.EditorFor(m => m.Material)
			@Html.ValidationMessageFor(m => m.Material)
		</td>
	</tr>
	<tr>
		<td class="adminTitle">
			@Html.SmartLabelFor(m => m.Pattern)
		</td>
		<td class="adminData">
			@Html.EditorFor(m => m.Pattern)
			@Html.ValidationMessageFor(m => m.Pattern)
		</td>
	</tr>
</table>

<script type="text/javascript">
	$(function () {

		$('#@Html.FieldIdFor(model => model.DefaultGoogleCategory)').select2({
			width: 'style',
			dropdownAutoWidth: true,
			allowClear: true,
			theme: 'bootstrap',
			closeOnSelect: true,
			placeholder: '',
			language: '@Model.LanguageSeoCode',
			ajax: {
				delay: 300,
				cache: true,
				dataType: 'json',
				type: 'GET',
				url: '@Url.Action("GetGoogleCategories", "FeedGoogleMerchantCenter", new { Namespaces = "SmartStore.GoogleMerchantCenter.Controllers", area = GoogleMerchantCenterFeedPlugin.SystemName })',
				data: function (params) {
					var query = {
						search: params.term,
						page: params.page || 1
					}
					return query;
				},
				processResults: function (data, params) {
					params.page = params.page || 1;

					return {
						results: data.results,
						pagination: {
							more: data.hasMoreItems
						}
					};
				}
			}
		});

	});
</script>
